/**
 * Created by Administrator on 2017/7/17 0017.
 */
var express = require('express');
var router = express.Router();


var mysql2 = require('mysql2');
var connection = mysql2.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'root',
    database: 'test'
});

connection.connect();

//'SELECT 1 + 1 AS solution'
connection.query('SELECT id as tid,username FROM user as tuser', function (error, results, fields) {
    if (error) {
        throw error;
    }
    console.log(results);
    console.log(fields);
});
connection.end();


router.get('/', function(req, res, next) {
    res.send('respond with a resource');
});



module.exports = router;


